// === message of number of plates information === // //<>//
int numPlates = 4; // number of plates. power up with 4 pcs
void drawNumPlates() { // draw number of plates information only, not draw the plates themselves
  fill(#F09B2C);
  textSize(60);
  text(numPlates, 1320, 110);
  textSize(30);
  text("number of plates", 1220, 45);
}

// ====== class of 10 plates ======= //
class cplate {
  cplate(int r, color colr, int plateNo, String colrName) {
    this.r = r;
    this.colr = colr;
    this.plateNo = plateNo;
    this.colrName = colrName;
    x = 0;
    y = 0;
    visible = false;
  }

  void paint() {
    if (visible) {
      fill(colr);
      rect(x, y, r, 16, 4, 4, 4, 4);
    }
  }

  int x, y; // looks like Processing doesn't care private, it is still like public
  boolean visible;
  private int r;
  color colr;
  int plateNo; // plate number [0, 9]
  String colrName; // for fun
};


// 1 is the biggest, 10 is the smallest
// plates name still use [1, 10], not [0, 9]

// 10 plates
cplate plate9 = new cplate(77, #d19c9e, 9, "pink"); // top most, smallest
cplate plate8 = new cplate(86, #ec6a81, 8, "dark pink");
cplate plate7 = new cplate(96, #93b184, 7, "light green");
cplate plate6 = new cplate(106, #18736f, 6, "cyan");
cplate plate5 = new cplate(118, #25539b, 5, "dark blue");
cplate plate4 = new cplate(131, #84be37, 4, "green");
cplate plate3 = new cplate(146, #40793d, 3, "dark green");
cplate plate2 = new cplate(162, #edd215, 2, "yellow");
cplate plate1 = new cplate(180, #f76826, 1, "orange");
cplate plate0 = new cplate(200, #eb4757, 0, "red"); // bottom most, biggest

// array of 10 paltes
cplate[] tenPlates = {
  plate0, plate1, plate2, plate3, plate4,
  plate5, plate6, plate7, plate8, plate9
};

// prepare all plates, ready of moving
void preparePlates(int npcs) {
  // remove all paltes No. from all poles
  for (cpole i : poles) {
    i.clearPlate();
  }

  // all plates invisible
  for (cplate i : tenPlates) {
    i.visible = false;
  }

  //push npsc plate into pole 1(TN). and they will be set visible
  for (int i = 0; i < npcs; i++) {
    poles[0].pushPlateIn(tenPlates[i]);
  }
  // so, now only the used plates are visible,
  // unused plates are invivisabe

  stopWatch.reset();
  stateMachine = 0;
}

// if the plate is visible, then it will be drawn
void draw10plates() {
  for (cplate i : tenPlates) {
    i.paint();
  }
}
